import request from '@/config/axios'

// 被监测设备 VO
export interface MonitorDeviceVO {
  id: number // ID
  deviceId: string // 设备ID
  deviceName: string // 设备名称
  deviceType: string // 设备类型
  deviceModel: string // 设备型号
  devicePic: string // 设备图片
  manufacturer: string // 生产厂家
  productionDate: Date // 出厂日期
  operationDate: Date // 投运日期
  remark: string // 备注
}

// 被监测设备 API
export const MonitorDeviceApi = {
  // 查询被监测设备分页
  getMonitorDevicePage: async (params: any) => {
    return await request.get({ url: `/vmiot/monitor-device/page`, params })
  },

  // 查询所有被监测设备列表
  getAllMonitorDeviceList: async () => {
    return await request.get({ url: `/vmiot/monitor-device/all-list` })
  },

  // 查询被监测设备详情
  getMonitorDevice: async (id: number) => {
    return await request.get({ url: `/vmiot/monitor-device/get?id=` + id })
  },

  // 新增被监测设备
  createMonitorDevice: async (data: MonitorDeviceVO) => {
    return await request.post({ url: `/vmiot/monitor-device/create`, data })
  },

  // 修改被监测设备
  updateMonitorDevice: async (data: MonitorDeviceVO) => {
    return await request.put({ url: `/vmiot/monitor-device/update`, data })
  },

  // 分配租户
  changeTenant: async (data) => {
    return await request.put({ url: `/vmiot/monitor-device/changeTenant`, data })
  },

  // 删除被监测设备
  deleteMonitorDevice: async (id: number) => {
    return await request.delete({ url: `/vmiot/monitor-device/delete?id=` + id })
  },

  // 导出被监测设备 Excel
  exportMonitorDevice: async (params) => {
    return await request.download({ url: `/vmiot/monitor-device/export-excel`, params })
  },

  // 查询所有被监测设备列表
  getAllMonitorDeviceListByShare: async (tenantId: number) => {
    return await request.get({
      url: `/vmiot/monitor-device/getAllMonitorDeviceListByTenantId?tenantId=${tenantId}`
    })
  }
}
